package com.seewintech.framework.common.login;

import com.seewintech.framework.common.exception.ServiceException;
import com.seewintech.framework.exception.AccountExceptionEnum;
import org.springframework.security.crypto.bcrypt.BCrypt;

/**
 * @author by xiaoTian
 * @date 2022/6/15.
 */
public class LoginUtils {

    public static void checkPassword(String inputPassword,String dbPassword,String salt){
        if (!BCrypt.hashpw(inputPassword, salt).equals(dbPassword)) {
            throw ServiceException.buildWithExceptionEnum(AccountExceptionEnum.USER_PASSWORD_ERROR);
        }
    }


}
